<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            width: 3000px;
            height: 3000px;
        }

        .a {
            width: 300px;
            height: 300px;
            background-color: #f00;
            margin: 100px;
            overflow: hidden;
        }

        .a1 {
            width: 100px;
            height: 100px;
            background-color: #ff0;
            margin: 50px;
        }
    </style>
</head>

<body>

    <div class="a">
        <div class="a1"></div>
    </div>

    <script>

        // e.clientX , e.clientY  距离浏览器边缘的坐标    可以简写为 e.x  e.y
        // e.pageX , e.pageY   距离实际页面的边缘的坐标
        // e.offsetX  e.offsetY   距离最具体的事件触发者的坐标(target)



        var oDiv = document.querySelector('div');

        oDiv.addEventListener('click', function (e) {
            e = e || event;

            console.log(e.clientX);

            console.log(e.x);

            console.log(e.pageX);

            console.log(e.offsetX);
        })

    </script>

</body>

</html>